package xyz.xtt.exchange.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.extern.slf4j.Slf4j;
import xyz.xtt.common.response.ApiResult;
import xyz.xtt.exchange.request.ImgToImgParam;
import xyz.xtt.exchange.service.NftService;

/**
 * @author huqibo
 * @date 2024/11/13
 */
@Schema(name = "下单", description = "下单")
@Slf4j
@RestController
@RequestMapping("/api/exchange")
public class AiController {
	@Autowired
	private NftService nftService;

	@Operation(summary = "AI图生图")
	@PostMapping("/nft/img_to_img")
	public ApiResult<String> imgToImg(@Validated @RequestBody ImgToImgParam imgToImgParam, @RequestHeader("uid") Long uid) {
		String aIUrl = nftService.getAiImgToImg(uid, imgToImgParam.getImgUrl(), imgToImgParam.getStyle());
		return ApiResult.ok(aIUrl);
	}
}
